<?php
/*=============================================================================
|| ##################################################################
||	phpFoX Konsort
|| ##################################################################
||	
||	Copyright		: (C) 2005-2007 PHPFOX Limited a Reality Fox Creation
||	Contact			: info@phpfox.com
||
||	- phpFoX and all of its source code and files are protected by Copyright Laws. 
||
||	- The license for phpFoX permits you to install this software on a single domain (.com, .org, .net, etc.). 
||
||	- You may also not remove this copyright screen which shows the copyright information and credits for phpFoX (RealityFOX Creations). 
||
||	- phpFoX Konsort is NOT a FREE software - http://www.phpfox.com/license/
||
|| ##################################################################
=============================================================================*/

/* $File: ./include/modules/Forum/classes/PhpFox_ComponentAdminForumList.class.php, $Author:  $ */



/** Forums list componment for Admin area.
 * 
 * @package module.forum
 * @version $Id: PhpFox_ComponentAdminForumList.class.php 46 2007-12-14 23:12:21Z phpfoxsv $
 *   
 */
class PhpFox_Mod_Forum_ComponentAdminForumList extends BaseComponent
{

    /** Processing method
     */
	function process()
	{
	    $oSrvForum = &$this->_oModule->getService('Forum');
	    /* @var $oSrvForum PhpFox_Mod_Forum_ServiceForum */
	    
	    $oReq = &App::getRequest();
	    /* @var $oReq Request */
        switch($oReq->getAction())
        {
            case 'forum_delete':
                $oForum = $this->_oModule->getItem('Forum');
                $iForumId = $oReq->getInt('id');
                if ($oForum->load($oReq->getInt('id')))
                {
                    if ($oSrvForum->deleteForum($iForumId))
                    {
                        $oUrl = &App::getUrl();
                        /* @var $oUrl Url */
                        $oUrl->clearParams('id');
                        $oUrl->clearParams('act');
                        App::forward($oUrl->getUrl(), App::format('Mod_Forum.forum.deleted'), 'message',
                                      App::getPageName(), 'AdminForumList');
                    }
                }
                else
                {
                    App::gotoUrl('admin.sections.forum');
                }
                break;
        }

	    
	    $aForums = $oSrvForum->getForumList();

		$oTpl = &$this->_oModule->getTemplate();
		$oTpl->assign(array(
            'aForums'      => $aForums,

		));
		$srcHtml = $oTpl->fetch('AdminForumList.html');
		return $srcHtml;
	}

}
?>